
import { request } from 'umi';

// 获取文章列表
export function getArticleList(page: number = 1) {
  let params = {
    page,
    pageSize: 6,
    status: 'publish'
  }
  return request('/api/article', {
    params
  });
}

// 获取文章详情
export function getArticleDetail(id: string) {
  return request(`/api/article/${id}`);
}

// 导航跳转
export function getArticleNav(item: string) {
  let params = {
    page: 1,
    pageSize: 12,
    status: 'publish'
  }
  return request(`/api/article/category/${item}`, { params })
}

// 首页导航数据
export function gitArticleNavList() {
  let params = {
    articleStatus: "public"
  }
  return request('/api/category', {
    params
  })
}

// Nav--前端数据
export function getArticleFe(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/fe', { params });
}
// Nav--后端数据
export function getArticleBe(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/Be', { params });
}
// Nav--阅读数据
export function getArticleReading(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/reading', { params });
}
// Nav--linux数据
export function getArticleLinux(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/linux', { params });
}
// Nav--leetcode数据
export function getArticleLeetcode(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/leetcode', { params });
}
// Nav--要闻数据
export function getArticleNews(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/news', { params });
}
// Nav--Java数据
export function getArticleJava(page: number = 1) {
  let params = {
    page,
    pageSize: 12,
    status: 'publish'
  }
  return request('/api/article/category/java', { params });
}
// 获取轮播
export function getArticleSwipers() {
  return request('/api/article/all/recommend');
}

// 支付、
export function getAlipay(payload:any) {
  return request('/api/alipay/create', {
    method: 'POST',
    data:payload
  })
}


// ​/api​/article​/recommend
